package phone.example.com.a36kr.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/8/17.
 * 股权投资的viewPagerAdapter
 */
public class InvestViewPagerAdapter extends FragmentPagerAdapter{

    private ArrayList<Fragment> fragments;
    private ArrayList<String> list = new ArrayList<>();

    public void setFragments(ArrayList<Fragment> fragments) {
        this.fragments = fragments;
        list.add("全部");
        list.add("募资中");
        list.add("募资完成");
        list.add("融资成功");
    }

    public InvestViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments == null ? 0 : fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position);
    }
}
